Skip to content

Fix highlight range computation for non-ascii characters#2742

Merged
lucasderraugh merged 1 commit into
masterfrom
lucasderraugh-fix-for-non-ascii-diffs
Dec 29, 2025
Merged

Fix highlight range computation for non-ascii characters#2742
lucasderraugh merged 1 commit into
masterfrom
lucasderraugh-fix-for-non-ascii-diffs

Conversation

@lucasderraugh
Copy link
Copy Markdown
Collaborator

@lucasderraugh lucasderraugh commented Dec 29, 2025

Fixes #2740

We were previously matching on the less specific 2-byte unicode point values, but this meant that something with with a 3 or 4 byte value (asian characters or emoji) would be first offset by 2 then loop incorrectly looking at the next character.

The fix is to look for the largest byte match first and then narrow down to the smaller byte matches.

Fixes #2740

We were previously matching on the less specific 2-byte unicode point values, but this meant that something with with a 3 or 4 byte value (asian characters or emoji) would be first offset by 2 then loop incorrectly looking at the next character.

The fix is to look for the largest byte match first and then narrow down to the smaller bit matches.
@lucasderraugh lucasderraugh merged commit e9e485b into master Dec 29, 2025
remaining = 3;
} else if (TEST_BITS(byte, 0b11110000)) {
remaining = 4;
if (TEST_BITS(byte, 0b11111100)) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 and 6 technically aren't in the standard but might as well keep them 🤷‍♂️

@lucasderraugh lucasderraugh deleted the lucasderraugh-fix-for-non-ascii-diffs branch December 30, 2025 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Crash on macOS 15.x when rendering rename-only diff in Diff view (NSAttributedString range exception)

1 participant